package com.mangowang.module.main.adapter;

import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.module.LoadMoreModule;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.mangowang.lib.common.help.GlideHelper;
import com.mangowang.lib.common.proto.Mystock;
import com.mangowang.lib.common.proto.Recharge;
import com.mangowang.module.main.R;
import com.ruffian.library.widget.RTextView;

import java.util.List;

public class AccountNewAdapter extends BaseQuickAdapter<Recharge.My_earnings.wallet_list, BaseViewHolder> {

    private  int type;
    private Context context;
    public AccountNewAdapter(Context context, List<Recharge.My_earnings.wallet_list> dataList,int type) {
        super(R.layout.item_account, dataList);
        this.type = type;
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, Recharge.My_earnings.wallet_list item) {
        helper.setText(R.id.tv_money_one,"¥ " + item.getBalance());
        ImageView iv_type = helper.getView(R.id.iv_type);
        GlideHelper.INSTANCE.loadImage(context,iv_type,item.getWalletImg());
        if (item.getIsCash().equals("0")) helper.setGone(R.id.tv_ti_xian, true);
        if (item.getIsCash().equals("1")) helper.setGone(R.id.tv_ti_xian, false);

        if (type == 1) helper.setBackgroundResource(R.id.iv_bg_two, R.mipmap.account_new_0);
        if (type == 2)
        {
            helper.setBackgroundResource(R.id.iv_bg_two,R.mipmap.account_new_1)
            .setTextColor(R.id.tv_ti_xian,Color.parseColor("#FFFF9205"));
           RTextView tvZhan = helper.getView(R.id.tv_zhan);
           tvZhan.getHelper().setBackgroundColorNormal(Color.parseColor("#FFFFE600"));
        }
    }
}
